package com.itheima04;

public class PrinterDemo {
    public static void main(String[] args) {

//        usePrinter(new Printer() {
//            @Override
//            public void printUpperCase(String s) {
//                String s1 = s.toUpperCase();
//                System.out.println(s1);
//            }
//        });

        usePrinter(s -> System.out.println(s.toUpperCase()));

        // 引用对象的实例方法
        PrinterString printerString = new PrinterString();
        usePrinter(printerString::printUpper);
    }

    private static void usePrinter(Printer p) {
        p.printUpperCase("HelloWorld");
    }

}
